<template>
    <m-page-wrapper>
      <m-crud ref="crudRef" :option="option">
      </m-crud>
    </m-page-wrapper>
  </template>
  <script setup lang="ts">
  import { reactive, ref,provide,watch } from 'vue';
  import { CrudType } from '/@/components/Crud/types';

  const crudRef = ref()
  
  const option = ref<CrudType>({
    // 弹窗类型
    // dialogType: 'drawer',
    // 弹窗属性
    dialogProps: {
      width: '60%'
    },
    // 表单属性
    formProps: {
      labelWidth: '100px',
      // labelCol: { flex: '100px' },
    },
    // 标题
    title: '边缘',
    // 列表接口
    api: '/DataDict/EdgeHardwareTypeDict',

      // 添加保存接口
    saveApi: '/DataDict/EdgeHardwareTypeDict',
    // 添加的权限码
    addPerms: 'setting:edge:save',
    // 修改的权限码
    editPerms: 'setting:edge:update',
    // 查看的权限码
    viewPerms: 'setting:edge:detail',
    // 删除的权限码
    delPerms: 'setting:edge:remove',
    columns: [
      {
        title: '宿主设备ID',
        dataIndex: 'hostDeviceTypeId',
        key: 'hostDeviceTypeId',
        list: false,
        view: false,
        add: false,
        edit: true,
        component: 'Input',
        componentProps: {
          type: "hidden",
          maxlength: 20,
        },
        rules: [{ required: false, message: '请输入字典ID', trigger: 'blur' }]
      },
      {
        title: '边缘网关ID',
        dataIndex: 'edgeHardwareTypeId',
        key: 'edgeHardwareTypeId',
        list: false,
        view: false,
        add: false,
        edit: true,
        component: 'Input',
        componentProps: {
          type: "hidden",
          maxlength: 20,
        },
        rules: [{ required: false, message: '请输入字典ID', trigger: 'blur' }]
      },
      {
        title: '字典名称',
        dataIndex: 'name',
        key: 'name',
        search: true,
        searchType: "EQ",
        list: true,
        view: true,
        add: true,
        edit: true,
        component: 'Input',
        componentProps: {
        },
        rules: [{ required: true, message: '请输入字典名称', trigger: 'blur' }]
      },
      {
        title: '设备类型',
        dataIndex: 'deviceTpye',
        key: 'deviceTpye',
        search: true,
        searchType: "EQ",
        list: true,
        view: true,
        add: true,
        edit: true,
        component: 'Dict',
        componentProps: {
          code: "device_type",
        },
        rules: [{ required: true, message: '请输入设备类型', trigger: 'blur' }]
      },
  
      {
        title: '图标',
        dataIndex: 'icon',
        key: 'icon',
        list: true,
        view: true,
        add: true,
        edit: true,
        component: 'Upload',
        componentProps: {
        },
        rules: [{ required: false, message: '请输入图标', trigger: 'blur' }]
      },
      {
        title: '描述',
        dataIndex: 'description',
        key: 'description',
        list: true,
        view: true,
        add: true,
        edit: true,
        component: 'Input',
        componentProps: {
        },
        rules: [{ required: false, message: '请输入分组编码', trigger: 'blur' }]
      },
  
    ]
  
  })

  
  </script>
  <style lang="less" scoped></style>